<?php
namespace Crm\Table;

class ProductCategoryTable extends AbstractTable
{

    protected $table = 'hy_product_category';

    protected $id = 'id';

    public function create($data)
    {
        $this->insert($data);
        $id = $this->lastInsertValue;
        
        return $id;
    }

    public function findHas($where)
    {
        $rowset = $this->select($where);
        $row = $rowset->current();
        return $row;
    }
    
    /**
     * 根据 产品ID 更改 分类ID
     * {@inheritDoc}
     * @see \Crm\Table\AbstractTable::updateById()
     */
    public function updateByProductId($data, $id)
    {
        return $this->update($data, array(
            'product_id' => $id
        ));
    }
    
    /**
     * 移除关系 暂未用
     * @param unknown $where
     */
    public function remove($id)
    {
        return $this->delete(array(
            'product_id' => $id
        ));
    }
}